<include file="../header" />
<body class="J_scroll_fixed">
	<div class="wrap J_check_wrap">
		<ul class="nav nav-tabs">
                        <li class="active"><a href="{:U('wechatMenu/index')}">公众号菜单</a></li>
			<li><a href="{:U('wechatMenu/add')}">添加主菜单</a></li>
			<li><a href="{:U('wechatMenu/additem')}">添加子菜单</a></li>
		</ul>
		<form class="J_ajaxForm" action="" method="post">
			<table class="table table-hover table-bordered table-list" id="menus-table">
				<thead>
                                        
					<tr>
                                                <th class="table-sort">排序</th>
                                                <th class="table-menuName">主菜单</th>
                                                <th class="table-menuName">子菜单</th>
                                                <th class="table-option">操作</th>
					</tr>
				</thead>
                                <tbody>
                                <foreach name="list" item="val">
                                  <tr>
                                    <td>{$val.sort}</td>
                                    <td>{$val.menu_name}</td>
                                    <td>
                                    <foreach name="val.items" item="item">
                                      <button type="button" class="btn btn-primary" onclick="location.href='{:U('wechatMenu/edititem')}&id={$item.menu_item_id}'"><span class="am-icon-plus"></span>{$item.name}</button>
                                    </foreach>
                                    </td>
                                    <td>
                                        <button type="button" class="btn btn-primary" onclick="location.href='{:U('wechatMenu/add')}&id={$val.menu_id}'"><span class="am-icon-edit"></span>编辑</button>
                                        <button type="button" class="btn btn-danger" onclick="location.href='{:U('wechatMenu/delete')}&id={$val.menu_id}'"><span class="am-icon-remove"></span>删除</button>
                                    </td>
                                  </tr>
                                  </foreach>
                                </tbody>
			</table>
		</form>
                <button type="button" class="btn btn-primary" onclick="location.href='/Wechat/Api/menuadd?key=luoe123'">重置到微信上==>执行</button>
	</div>
	<script src="__ROOT__/statics/js/common.js"></script>
	<script>
		$(document).ready(function() {
			Wind.css('treeTable');
			Wind.use('treeTable', function() {
				$("#menus-table").treeTable({
					indent : 20
				});
			});
		});

		setInterval(function() {
			var refersh_time = getCookie('refersh_time_admin_menu_index');
			if (refersh_time == 1) {
				reloadPage(window);
			}
		}, 1000);
		setCookie('refersh_time_admin_menu_index', 0);
	</script>
</body>
</html>